/*
 * Original Author -> Harry Yang (taketoday@foxmail.com) https://taketoday.cn
 * Copyright © TODAY & 2017 - 2021 All Rights Reserved.
 *
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see [http://www.gnu.org/licenses/]
 */

package cn.taketoday.web.socket;

import java.util.HashMap;
import java.util.Map;

/**
 * A simple representation of a websocket extension
 * as a name and map of extension parameters.
 *
 * @author TODAY 2021/5/6 16:40
 * @since 3.0.1
 */
public class WebSocketExtension {
  private final String name;
  private final Map<String, String> parameters;

  public WebSocketExtension(String name) {
    this(name, new HashMap<>());
  }

  public WebSocketExtension(String name, Map<String, String> parameters) {
    this.name = name;
    this.parameters = parameters;
  }

  public String getName() {
    return name;
  }

  public Map<String, String> getParameters() {
    return parameters;
  }

  /**
   * @param name the name of the extension parameter.
   * @param value the value of the extension parameter.
   */
  public void addParameter(String name, String value) {
    parameters.put(name, value);
  }

}
